<template>
	<view>
		<div v-for="(order, index) in OrderData" :key="index">
			<view class="cu-timeline">
				<view class="cu-item">
					<view class="content">

						<view class="cu-capsule radius">
							<view class="cu-tag bg-cyan">旅游时间</view>
							<view class="cu-tag line-cyan">{{order.reservationTime}}</view>
						</view>
						<view class="margin-top">

						</view>
						<view class="">
							<view class="content">订 单 号:   {{order.id}}</view>
							<view class="content">旅游人数:   {{order.togetherNumber}}</view>
							<view class="content">付款金额:   {{order.amount}}元</view>
							<view class="content" >付款时间:{{order.createTime}}</view><!-- toDate(Number, 1) -->
							<view class="content">付 款 人:   {{order.createUser}}</view>
						</view>
						<view class="margin-top">

						</view>

					</view>
				</view>
			</view>
		</div>
	</view>
</template>

<script>

	export default {

		data() {
			return {
				OrderData: [],
				id: '',
			}
		},
		methods: {
			/*happenTimeFun(createTime){//时间戳数据处理
			        let date = new Date(num);
			         //时间戳为10位需*1000，时间戳为13位的话不需乘1000
			        let y = date.getFullYear();
			        let MM = date.getMonth() + 1;
			        MM = MM < 10 ? ('0' + MM) : MM;//月补0
			        let d = date.getDate();
			        d = d < 10 ? ('0' + d) : d;//天补0
			        let h = date.getHours();
			        h = h < 10 ? ('0' + h) : h;//小时补0
			        let m = date.getMinutes();
			        m = m < 10 ? ('0' + m) : m;//分钟补0
			        let s = date.getSeconds();
			        s = s < 10 ? ('0' + s) : s;//秒补0
			        return y + '-' + MM + '-' + d + ' ' + h + ':' + m+ ':' + s;
			},*/

		},
		onLoad(option) { //option为object类型，会序列化上个页面传递的参数
			console.log(option.id); //打印出上个页面传递的参数。
			// this.openid = option.openid;
			this.id = option.id;
			//需要的页面引入

			//转换的地方写入
			// util.js_date_time('时间戳')

		},


		mounted() {

			this.$axios({
				method: 'get',
				url: '/order/getOrderByUserId/' + this.id,
			}).then(res => {
				this.OrderData = res.data;
				let i = 0;
				for (let item in this.OrderData) {
					if (i == 0) {
						this.$set(this.showArea, item, true);
					} else {
						this.$set(this.showArea, item, false);
					}
					i++;
				}
			}).catch(err => {
				console.log(err)
			})
		}
	}
</script>

<style>

</style>
